<template>
    <slot :open="onopen"></slot>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { layer } from '@layui/layer-vue';
import type { ImageType } from 'aoe';

const props = defineProps<{
    images?: Array<ImageType>;
}>();

const opened = ref(false);

const get_layer = () => {
    opened.value = true;
    layer.open({
        type: 5,
        imgList: props.images,
        close: () => (opened.value = false),
    });
};

const onopen = () => opened.value || get_layer();
</script>

<style scoped></style>
